#pragma once

#ifndef LGBPLIBINCLUDE
#define LGBPLIBINCLUDE
// #ifdef LGBPLIB_EXPORTS
// #define FACEFEATMOD_API  __declspec(dllexport)
// #else
// #define FACEFEATMOD_API  __declspec(dllimport)
// #endif
#define FACEFEATMOD_API

enum FacePose{ _PD00, _PD15, _PD30, _PM00, _PM15, _PM30, _PU00, _PU15, _PU30, TotalPoses};

const int GABOR_ORIENT=8;
const int GABOR_SCALE = 5;
const int MULTILEVELS = 1;
const int GBC_ORIENT = 8;

const int GABOR_ORIENTs[TotalPoses][GABOR_ORIENT] = 
{
	{0, 1, 4, 7},{3, 4, 6, 7},{2, 3, 4, 6},
	{0, 1, 3, 6},{0, 2, 3, 7},{0, 3, 4, 6},
	{1, 4, 5, 7},{3, 4, 6, 7},{0, 2, 5, 6}
};
const int GABOR_SCALEs[GABOR_SCALE] = {0, 1, 2, 3, 4};

typedef BYTE FeatureType;
typedef float MappingFeatureType;

class FACEFEATMOD_API LGBPExtractor
{
public:
	LGBPExtractor(int iBlockX, int iBlockY, FAST::TMatrix<MappingFeatureType> *matAlpha, int featureSelection);
	LGBPExtractor(int iBlockX, int iBlockY, char* alphaFileName, int featureSelection);
	~LGBPExtractor(void);
	int ExtractFeatures(IplImage* pSrcImg, int faceOrient = _PM00);
	void MakeMappingTestFile(int nBinNum = LGBPExtractor::nBinNum);
	FAST::TMatrix<MappingFeatureType>* getOutMat();
	FAST::TMatrix<FeatureType>*getRawMat();

	const static int nBinNum = 59;
private:
	void Init(int iBlockX, int iBlockY, int featureSelection);
	void ExtractFeaturesOnSingleLevel(IplImage* pImage, int iW, int iH, FeatureType* pFeatureBuff, int faceOrient);

	bool outsideAlpha;

	int m_iBlockX;
	int m_iBlockY;
	int m_featureSelection;
	FAST::TMatrix<FeatureType> *m_matFeatures;
	FAST::TMatrix<MappingFeatureType> *m_matAlpha;
	FAST::TMatrix<MappingFeatureType> *outMat;
};

#endif